﻿@model JaxaraRnD.Models.Objects.Order
@using JaxaraRnD.Helpers
@{
    ViewBag.Title = "Details";
}
<fieldset>
    <legend>Order Details</legend>

    <div>
        <label>
            IssueDate:
        </label>
        <span class="detailsinfo">@Model.IssueDate</span>
    </div>
    @if (Model.Staff != null)
    {
        <div>
            <label>
                Staff Name:
            </label>
            <span class="detailsinfo">@Model.Staff.Name</span>
        </div>
    }
    @Html.ActionLink("Edit", "Edit", new { id = Model.Id })
    <h3>Related Products</h3>
    @if (Model.Products != null && Model.Products.Count() > 0)
    {
        WebGrid grid = new WebGrid(source: Model.Products, canPage: true, rowsPerPage: JaxaraRnDUtility.GridConstants.ROWS_PER_PAGE);

        <div id="grid">
            @grid.GetHtml(
                tableStyle: "gridTable",
                headerStyle: "gridTableHeader gridTableHeaderLeft",
                rowStyle: "rowstyle",
                alternatingRowStyle: "alternaterowstyle",
                footerStyle: "paging",
                columns:
                grid.Columns(
                grid.Column(header: "Name", format: @<text><div class="text-align-left">@item.Name</div></text>),
                grid.Column(header: "Category", format: @<text><div class="text-align-left">@item.Category</div></text>),
                grid.Column("Details", "Details", format: @<text>@Html.ActionLink(" ", "Details", "Product", new { id = item.Id }, new { style = "background: url('" + Url.Content("~/Images/ico-view-detailed.png") + "')no-repeat center right; display:block; height:32px; width:32px;" })</text>, canSort: false, style: "text-align-center")
            )
            )
        </div>
    }
    else
    {
        <text><div class="no-data-found">@JaxaraRnDUtility.GridConstants.EMPTY_DATA_MESSAGE</div></text>

    }
</fieldset>
<p>

    @Html.ActionLink("Back to List", "Index")
</p>
